public class doPower {

  private static final int numMatrices = 1000;
  private static final int maxIterations = 5000000;
  private static final double tolerance = 0.0000000001;

  public static void main(String[] argVector) {
    Matrix [] randoms = new Matrix[numMatrices];
    double [] [] eigenvalues = new double[numMatrices][2];
    double [] determinants = new double[numMatrices];
    double [] traces = new double[numMatrices];
    int [] [] iterations = new int[numMatrices][2];
    for (int i = 0; i < numMatrices; i++) {
      randoms[i] = Matrix.randomTwoByTwo(0, .01);
      determinants[i] = randoms[i].determinant();
      traces[i] = randoms[i].trace();
      Tuple<Double,Integer> eigen = randoms[i].power(maxIterations, tolerance);
      eigenvalues[i][0] = eigen.fst;
      iterations[i][0] = eigen.snd;
      eigen = randoms[i].inversePower(maxIterations, tolerance);
      eigenvalues[i][1] = eigen.fst;
      iterations[i][1] = eigen.snd;
      System.out.println(java.util.Arrays.deepToString(randoms[i].getTheMatrix()));
      System.out.println(determinants[i] + " " + traces[i]);
      System.out.println(eigenvalues[i][0] + " " + eigenvalues[i][1]);
      System.out.println(iterations[i][0] + " " + iterations[i][1]);
    }
  }
}
